﻿#include "gamescene.h"
#include "ui_gamescene.h"
#include<QMouseEvent>
GameScene::GameScene(QWidget *parent) :
    QWidget(parent),
    QGraphicsView(parent),
    ui(new Ui::GameScene)
{
    ui->setupUi(this);
}

GameScene::~GameScene()
{
    delete ui;

}

void GameScene::paintEvent(QPaintEvent *event)
{
    //画背景
    QPainter painter(this);
    QPixmap pix;
    pix.load(":/image/seaworld2.png");
    painter.drawPixmap(0,0,this->width(),this->height(),pix);

    //画发射装置
    pix.load(":/image/pao5.png");


    painter.drawPixmap(this->width()/2,this->height()-pix.height(),pix);
}

void GameScene::mouseMoveEvent(QMouseEvent *event)
{
    //发射装置随鼠标旋转
     p=event->pos();

     update();
}
